home *** CD-ROM | disk | FTP | other *** search
- <title>New Cylinder</title>
-
- <script language="EasyScript">
-
- registry = "New\\Model\\Cylinder";
-
- /////////////////
- function OnLoad ()
- {
- length_x = getRegistryValue (registry, "length_x", 100);
- length_y = getRegistryValue (registry, "length_y", 100);
- length_z = getRegistryValue (registry, "length_z", 100);
-
- div_p = getRegistryValue (registry, "div_p", 10);
-
- model = new Model;
- model.setName ("Cylinder");
- }
- //////////////////////
- function CreateModel ()
- {
- if (div_p < 1) div_p = 1;
-
- ip = 1 / div_p;
-
- array0 = new Array;
- array1 = new Array;
- array2 = new Array;
- array3 = new Array;
-
- for (p=1; p>ip/2-1; p-=ip){
- vertex = new Vertex3D;
- vertex.x = length_x * sin(p*pi) / 2;
- vertex.y = length_y / 2;
- vertex.z = length_z * cos(p*pi) / 2;
- index = model.addVertex (vertex);
- array0.add (index);
- vertex = new Vertex3D;
- vertex.x = length_x * sin(p*pi) / 2;
- vertex.y = length_y / 2;
- vertex.z = length_z * cos(p*pi) / 2;
- index = model.addVertex (vertex);
- array1.add (index);}
-
- for (p=-1; p<1-ip/2; p+=ip){
- vertex = new Vertex3D;
- vertex.x = length_x * sin(p*pi) / 2;
- vertex.y = -length_y / 2;
- vertex.z = length_z * cos(p*pi) / 2;
- index = model.addVertex (vertex);
- array2.add (index);
- vertex = new Vertex3D;
- vertex.x = length_x * sin(p*pi) / 2;
- vertex.y = -length_y / 2;
- vertex.z = length_z * cos(p*pi) / 2;
- index = model.addVertex (vertex);
- array3.add (index);}
-
- model.addPolygon (array0);
- model.addPolygon (array3);
-
- for (v=1; v< array1.count-1; v++){
- model.addPolygon (array1[array1.count-v],array1[array1.count-v-1],array2[v+1],array2[v]);}
-
- model.addPolygon (array1[1], array1[0], array2[0], array2[array1.count-1]);
- model.addPolygon (array1[0], array1[array1.count-1], array2[1], array2[0]);
-
- for (i=0; i< model.polygons.count; i++){
- if (i < 2) model.polygons[i].smooth = false;
- model.polygons[i].face = 1;}
-
- model.applyTexture ("cylindrical", 'Y');
-
- setRegistryValue (registry, "length_x", length_x);
- setRegistryValue (registry, "length_y", length_y);
- setRegistryValue (registry, "length_z", length_z);
-
- setRegistryValue (registry, "div_p", div_p);
-
- window.returnValue (model);
- window.close ();
- }
-
- </script>
-
- <body bgcolor="normal" text="#000000" OnLoad="OnLoad()" translate>
- <div valign=middle>
-
- <table width="100%" cellspacing=4 cellpadding=0 bgcolor="light" borderstyle="raised">
- <tr><td valign=top><img src="images/large_model.bitmap">
- <td><table>
- <tr><td>
- <font size=5>Cylinder</font>
- <td><input type="text" size=16 name="model.name">
- </table></table>
-
- <spacer height=4>
-
- <table width=100% cellspacing=4 cellpadding=4 bgcolor="light" borderstyle="raised">
- <tr><td>
- <table>
- <font size=1>
- <tr><td></td><td align=center>X</td><td align=center>Y</td><td align=center>Z</td></tr>
- </font>
- <tr>
- <td>Length
- <td><input type=text name="length_x" size=5>
- <td><input type=text name="length_y" size=5>
- <td><input type=text name="length_z" size=5>
- </tr>
- </table>
- <tr><td>
- <table>
- <tr>
- <td>Divisions
- <td><input type=text name="div_p" size=4>
- </table>
-
- </table>
-
- <spacer height=8>
-
- <table cellspacing=0 cellpadding=0 width="100%">
- <tr><td align=right>
- <a button onMouseUp="CreateModel()" width=+16 height=+3><img src="images/small_model.bitmap" hspace=4>Create cylinder</a>
- <a button onMouseUp="window.close()" width=+32 height=+3>Cancel</a>
- </table>
-
- <spacer height=4>
-